<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ taglib prefix="sec"
	uri="/WEB-INF/tags/shiro.tld"%>
	<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<% 
Object lang=session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
String languageCode="zh_CN";
if(lang!=null){
	languageCode=lang.toString();
}
	Locale locale =SessionHelper.getLocaleByUser(request);
%>
	
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>索引</title>
<base href="<%=ViewUtil.getRequestPath(request)%>">
<jsp:include
	page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
<script type="text/javascript"
	src="avicit/cbb/techclass/tabledefine/commtablemanager/TableColIndex.js"></script>
<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
<script type="text/javascript"
	src="avicit/cbb/techclass/tabledefine/commtablemanager/locale/language_<%=languageCode%>.js"></script>
<link href="static/css/custom/lantop/css/custom.css" type="text/css"  rel="stylesheet">
<%
	String sysId = request.getParameter("sysId");
	String tableName = request.getParameter("tableName");
	String nodeTypeNew = request.getParameter("nodeType");
	String nodeId = request.getParameter("nodeId");
	String nodeName = request.getParameter("nodeName");
	String nodeCode = request.getParameter("nodeCode");
%>
<script type="text/javascript">
var baseurl = "<%=ViewUtil.getRequestPath(request)%>";
	//此事件必须放在jsp中,不能提取到js中,否则不能加载数据
	$(function() {
		sysId = "<%=sysId%>";
		tableName = "<%=tableName%>";
		nodeTypeNew = "<%=nodeTypeNew%>";
		nodeId = "<%=nodeId%>";
		nodeName = "<%=nodeName%>";
		nodeCode = "<%=nodeCode%>";
		if ("" == tableName || "null" == tableName) {
			tableName = "CBB_CS_WJ";
		}
		if ("" == nodeTypeNew || "null" == nodeTypeNew) {
			nodeTypeNew = "Y";
		}
		if (nodeTypeNew == "N") {
			$('#addTempField').linkbutton('disable');
			$('#deleteTempField').linkbutton('disable');
			$('#saveTempField').linkbutton('disable');
		}
		if ("" == sysId || "null" == sysId) {
			sysId = "CBB";
		}
		if ("" == nodeId || "null" == nodeId) {
			nodeId = "-1";
		}
		if ("" == nodeName || "null" == nodeName) {
			nodeName = "测试";
		}
		$
				.ajax({
					url : 'platform/aos/commtablemanagerController/getColLabelData.json',
					data : {
						sysId : sysId,
						nodeId : nodeId,
						nodeName : nodeName,
						tableName : tableName
					},
					type : 'post',
					dataType : 'json',
					success : function(result) {
						//接收下拉列表数据
						comboData = result.data;
						$('#cbbIndexTabColumnsDataGrid')
								.datagrid(
										{
											url : 'platform/aos/commtablemanagerController/getCbbTabIndexData.json?sysId='
													+ sysId
													+ '&tableName='
													+ tableName
										});
					}
				});

	});
</script>
<style type="text/css">
.textbox {
	border: solid 1px #a5acb5;
}

.input,img {
	vertical-align: middle;
}
.selbtnc {
	margin-left:5px;
}

<!--
实现input和img水平对齐 -->.labelbg {
	background:
		url('../../js/jQuery/jquery-easyui-1.3.5/themes/icons/required.gif')
		right 0 no-repeat;
}
</style>
</head>
<body id="myBody" class="easyui-layout"><!--  -->
	<div id="tb" style="overflow: hidden; font-size: 0;padding:10px 5px;">
		<sec:accesscontrollist hasPermission="3"
			domainObject="commtablemanager_TableColIndex_button_addTempField">
			<%-- 添加 --%>
			<a class="easyui-linkbutton selbtnc" iconCls="icon-im-add"  style="margin-left:20px;"
				onclick="append();" href="javascript:void(0);" id="addTempField"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.button.add","i18n.lantop",locale)%></a>
		</sec:accesscontrollist>
		<sec:accesscontrollist hasPermission="3"
			domainObject="commtablemanager_TableColIndex_button_deleteTempField">
			<%-- 删除 --%>
			<a class="easyui-linkbutton selbtnc" iconCls="icon-im-remove"
				onclick="removeit();" href="javascript:void(0);"
				id="deleteTempField"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.button.delete","i18n.lantop",locale)%></a>
		</sec:accesscontrollist>
		<sec:accesscontrollist hasPermission="3"
			domainObject="commtablemanager_TableColIndex_button_saveTempField">
			<%-- 保存 --%>
			<a class="easyui-linkbutton selbtnc" iconCls="icon-im-save"
				onclick="accept();" href="javascript:void(0);" id="saveTempField"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.button.save","i18n.lantop",locale)%></a>
		</sec:accesscontrollist>
	</div>
	<div data-options="region:'center',border:false" id="colTab"
		style="height: 0; overflow: hidden; font-size: 0;">
		<table id="cbbIndexTabColumnsDataGrid" data-options="
										rownumbers: true,
										animate: true,
										collapsible: false,
										fitColumns: true,
										autoRowHeight: false,
										singleSelect: true,
										pagination:true,
										pageSize:10, 
										pageList:[100,150,200], 
							    		striped:true,
										fit:true,
										method: 'post',
										selectOnCheck:false,
										scrollbarSize:0,
										checkOnSelect:false,
										toolbar: '#tb',
										onClickRow:onClickRow
									">
			<thead>
				<tr>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_TableColIndex_button_ID">
						<th data-options="field:'ID', halign:'center',checkbox:true"
							title="主键ID" width="20">主键ID</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_TableColIndex_button_INDEX_NAME">
						<%-- 索引名称 --%>
						<th
							data-options="field:'INDEX_NAME',halign:'center', align:'center',editor:{type:'text'},formatter: formatTooltip"
							width="100" title="索引名称"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.indexName","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_TableColIndex_button_COL_ID">
						<th data-options="field:'COL_ID',hidden:true,editor:{type:'text'}">字段ID</th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_TableColIndex_button_COL_LABEL">
						<%-- 字段中文名 --%>
						<th
							data-options="field:'COL_LABEL',halign:'center', align:'center', editor:{type:'validatebox',options:{required:true,validType:'length[0,100]'}},formatter:fomaterColNameType"
							width="100" title="字段中文名"><img
							src="avicit/im/common/im_themes_extend/required.gif" alt="必填">
							<%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.fieldCHNName","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_TableColIndex_button_COL_NAME">
						<%-- 字段名 --%>
						<th
							data-options="field:'COL_NAME', halign:'center', align:'center',editor:{type:'text'},formatter: formatTooltip"
							width="100" title="字段名"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.fieldName","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="commtablemanager_TableColIndex_button_INDEX_TYPE">
						<%-- 类型 --%>
						<th
							data-options="field:'INDEX_TYPE', halign:'center', align:'center',editor:{type:'combobox',options:{tipPosition:'left',deltaX:10,required:true,panelHeight: 'auto',valueField:'lookupCode',textField:'lookupName',data:[{lookupCode:'1',lookupName:'普通索引'},{lookupCode:'2',lookupName:'唯一索引'}],editable:false}},formatter:fomaterIndexType"
							width="100" title="类型"><img
							src="avicit/im/common/im_themes_extend/required.gif" alt="必填"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.index.table.type","i18n.lantop",locale)%></th>
					</sec:accesscontrollist>
				</tr>
			</thead>
		</table>
	</div>
</body>
<script type="text/javascript" src="static/js/platform/index/js/divscroll.js" ></script>
<script>
	$(function(){
		$(".datagrid-view2").find(".datagrid-body").perfectScrollbar();
		$.extend($.fn.combobox.defaults, {
		    panelMaxHeight : 150 //最大高度
		});
	});
</script>
</html>
